import request from '@/utils/request'

// 获取员工薪资列表
export function getSalarysList(data) {
  return request({
    url: '/salarys/list',
    method: 'post',
    data
  })
}

// 根据id查询用户薪资
export function getSalarysListById(userId) {
  return request({
    url: `/salarys/modify/${userId}`
  })
}

// 获取企业是否设置当月工资
export function getCompanySetting() {
  return request({
    url: `/salarys/company-settings`
  })
}

// 员工定薪
export function initSalarys(data) {
  return request({
    url: `/salarys/init/${data.userId}`,
    method: 'post',
    data
  })
}

// 查询用户薪资详情
export function getSalaryDetail(userId) {
  return request({
    url: `/salarys/modify/${userId}`
  })
}

// 调薪
export function wageSalary(data) {
  return request({
    url: `/salarys/modify/${data.userId}`,
    method: 'post',
    data
  })
}

// 保存企业计薪及津贴设置
export function getSettings() {
  return request({
    url: '/salarys/settings'
  })
}

// 保存企业计薪及津贴设置
export function savaSettings(data) {
  return request({
    url: '/salarys/settings',
    method: 'post',
    data
  })
}

// 根据年月查询企业用户薪资列表
export function getSalarysDetailByYear(params) {
  return request({
    url: `/salarys/reports/${params.yearMonth}`,
    method: 'get',
    params
  })
}

// 构造新月份工资报表
export function newReport(data) {
  return request({
    url: `/salarys/reports/${data.yearMonth}/newReport`,
    method: 'put',
    data
  })
}

// 归档功能
export function getArchivingArchive(data) {
  return request({
    url: `/salarys/reports/${data.yearMonth}/archive`,
    data,
    method: 'post'
  })
}
